/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.muni.fi.pa036is.dtoconverters;

import cz.muni.fi.pa036is.dto.AdmissionFormTO;
import cz.muni.fi.pa036is.dto.AdmissionGridTO;
import cz.muni.fi.pa036is.entity.Admission;
import cz.muni.fi.pa036is.entity.Person;
import cz.muni.fi.pa036is.entity.Season;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Shebik
 */
public class AdmissionConverter {
    
    private AdmissionConverter() {
    }

    public static Admission convertToAdmission(final AdmissionFormTO admissionFormTO) {
        final Admission admission = new Admission();
        admission.setId(admissionFormTO.getId());
        admission.setSeasonId(admissionFormTO.getSeasonId());
        admission.setPersonId(admissionFormTO.getPersonId());
        return admission;
    }
				
				public static Admission convertToAdmission(final AdmissionGridTO admissionGridTO) {
        final Admission admission = new Admission();
        admission.setId(admissionGridTO.getId());
        admission.setSeasonId(admissionGridTO.getSeasonId());
        admission.setPersonId(admissionGridTO.getPersonId());
        return admission;
    }

    public static AdmissionFormTO convertToAdmissionFormTO(final Admission admission,
            final Person person, final Season season) {
        final AdmissionFormTO admissionFormTO = new AdmissionFormTO();
        admissionFormTO.setId(admission.getId());
        admissionFormTO.setPersonId(person.getId());
        admissionFormTO.setPersonFirstName(person.getFirstName());
        admissionFormTO.setPersonLastName(person.getLastName());
        admissionFormTO.setSeasonId(season.getId());
        admissionFormTO.setSeasonName(season.getName());
        admissionFormTO.setStartDate(season.getStartDate());
        admissionFormTO.setEndDate(season.getEndDate());
        admissionFormTO.setPrice(season.getAdmissionPrice());
        return admissionFormTO;
    }
    
    public static AdmissionGridTO convertToAdmissionGridTO(
            final Admission admission, final Season season) {
        final AdmissionGridTO admissionGridTO = new AdmissionGridTO();
        admissionGridTO.setId(admission.getId());
        admissionGridTO.setTimestamp(admission.getDate());
        admissionGridTO.setSeasonName(season.getName());
        admissionGridTO.setStartDate(season.getStartDate());
        admissionGridTO.setEndDate(season.getEndDate());
        admissionGridTO.setPrice(season.getAdmissionPrice());
		admissionGridTO.setSeasonId(season.getId());
        return admissionGridTO;
    }

    public static AdmissionGridTO convertToAdmissionGridTO(
            final Admission admission, final Season season, final Person person) {
        final AdmissionGridTO admissionGridTO = convertToAdmissionGridTO(
                admission, season);
        admissionGridTO.setPersonId(person.getId());
        admissionGridTO.setPersonFirstName(person.getFirstName());
        admissionGridTO.setPersonLastName(person.getLastName());
        return admissionGridTO;
    }

}
